﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Content.Pipeline;
using System.IO;
using System.Xml.Serialization;
using Microsoft.Xna.Framework;

using DanielsGameLibrary;
namespace ContentPipelineExtension
{
    [ContentImporter( ".bmmap", DefaultProcessor = "MapProcessor",
      DisplayName = "Map Importer")]
    class MapImporter : ContentImporter<MapData>
    {
        public override MapData Import(string filename,
        ContentImporterContext context)
        {
            FileStream stream = File.Open(filename, FileMode.Open);

            // Read the data from the file.
            XmlSerializer serializer = new XmlSerializer(typeof(MapData));
            MapData data = (MapData)serializer.Deserialize(stream);

            // Close the file.
            stream.Close();
            return data;
        }
    }
}
